package 一四省B;

import java.util.HashSet;
import java.util.Set;

public class q2 {

	public static int count = 0;
	
	
	//检查是否满足规则二
	public static void check(char[] ch){
		//char[] ch = new StringBuffer(num).toString().toCharArray();
		int a = Integer.parseInt(ch[0]+""+ch[1]);
		int b = Integer.parseInt(ch[2]+""+ch[3]+""+ch[4]+"");
		int c = Integer.parseInt(ch[0]+""+ch[3]+""+ch[1]+"");
		int d = Integer.parseInt(ch[2]+""+ch[4]+""); 
		if(a*b == c*d){
			count++;
		}
	}
	
	public static boolean chongheAndContainZero(char[] ch){
	    Set<Character> hashSet = new HashSet<Character>();
		//char[] ch = new StringBuffer(num).toString().toCharArray();
		
		for(int i=0;i<ch.length;i++){
			if(ch[i] == '0'){
				return true;
			}
			hashSet.add(ch[i]);
		}
		
		if(hashSet.size() < 5){
			return true;
		}
		return false;
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		for(int i=36495;i<=99999;i++){
			char[] ch = (i+"").toString().toCharArray();
			if(!chongheAndContainZero(ch)){
				//System.out.println(i);
				check(ch);
			}
		}
		
		System.out.println(count);
	}

}
